//
// Created by wze-zero on 2024/9/14 014.
//
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int num, n;
    string s, t;
    cin >> num;
    for (int i = 1; i < num + 1; ++i) {
        s = t = "";
        n = i;
        while (n != 0) {
            s += to_string(n % 10);
            n /= 10;
        }
        t = s;
        reverse(s.begin(), s.end());
        if (s == t) {
            cout << t << endl;
        }
    }
    return 0;
}